package com.itmuch;

import com.itmuch.filter.AccessFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@EnableZuulProxy
@EnableEurekaClient //向eurak注册中心注册
@ComponentScan("com.itmuch")
/**
 *
 * Zuul使用Ribbon来定位一个通过发现转发的实例，所有请求都以hystrix命令执行，所以故障将显示在Hystrix指标中。
 * 默认只在过滤器改变requestheader就行了
 */
public class ApiGatewayZuulApplication {

    public static void main(String[] args) {
        SpringApplication.run(ApiGatewayZuulApplication.class, args);
    }

    //order的数值越小,优先级越高
    @Bean
    public AccessFilter accessFilter() {
        return new AccessFilter();
    }

}
